import { createStore } from "vuex";
import moduleA from "./modules/moudleA";
import moduleB from "./modules/moudleB";
export default createStore({
  state: {
    count: 0
  },
  mutations: {
    increment(state) {
			state.count++;
		}
  },
  getters: {
    doubleCount (state) {
      return state.count * 2
    }
  },
  actions: {
    incrementIfOddOnRootSum({ state, commit, rootState }) {
			if ((state.count + rootState.count) % 2 === 1) {
				commit('increment');
			}
		}
  },
  modules: {
    a: moduleA,
    b: moduleB
  }
});
